home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / etc / init.d / network.z / network
Text File  |  1992-04-03  |  21KB  |  690 lines

  1. #! /bin/sh
  2. #Tag 0x00000f00
  3.  
  4. # Initialize/Shutdown the standard and optional network software.
  5. #
  6. # $Revision: 4.13 $
  7. #
  8. # If the IP address for this host is the default 192.0.2.1 Internet test
  9. # address, the software is configured for loopback (standalone) mode.
  10. # An Internet address other than the default must be chosen in order to
  11. # configure the network properly. See the "Network Administration" chapter
  12. # in the Network Communications Guide or details on selecting an address.
  13. #
  14. # NOTE: Defaults for network interface names and addresses can be changed by
  15. # editting /etc/config/netif.options. Therefore, you don't need to edit
  16. # this file.
  17. #
  18. # A daemon or subsystem is enabled if its configuration flag in the
  19. # /etc/config directory in the "on" state.  /etc/chkconfig is used
  20. # to test a flag's state (see chkconfig(1M) for details). If the flag
  21. # file is missing, the flag is considered off.
  22. #
  23. #    Flag        Action if On
  24. #    network        Allow incoming & outgoing traffic. This flag can be
  25. #             set off if you need to isolate the machine from
  26. #             network without removing cables.
  27. #    verbose        Print name of daemons as they are started & other info
  28. #    gated        Start Cornell routing daemon instead of BSD routed
  29. #    mrouted        Start Stanford IP multicast routing daemon
  30. #             (Useful only on gateways)
  31. #    named        Start 4.3BSD Internet domain name server
  32. #    rwhod        Start 4.3BSD rwho daemon
  33. #    snmpd        Start Simple Network Management Protocol daemon
  34. #    timed        Start 4.3BSD time synchronization daemon
  35. #    timeslave    Start SGI time synchronization daemon
  36. #    hypernet    Initialize HyperNET controller and routes
  37. #    routed        Start 4.3BSD RIP routing daemon
  38. #    rtnetd        Initialize preemptable networking for real-time use
  39. #    ipfilterd    Enable SGI IP Packet Filtering daemon
  40. #
  41. # The following flags are installed only in the optional products:
  42. #
  43. #    nfs        Start NFS daemons, mount NFS filesystems
  44. #    automount    Start the NFS automounter daemon
  45. #    lockd        Start the NFS lock and status daemons
  46. #    pcnfsd        Start the PC-NFS server daemon
  47. #    rarpd        Start the Reverse ARP daemon
  48. #    yp        Enable NIS, start ypbind daemon
  49. #    ypserv        If yp is on, become a NIS server
  50. #    ypmaster    If yp is on, become the NIS master; start passwd server
  51. #             (ypserv should be on, too)
  52. #    4DDN        Initialize 4DDN (DECnet connectivity) software
  53. #
  54. # Site-dependent options for daemons belong in "options" files in /etc/config.
  55. # Certain daemons require options so their options file must contain valid
  56. # information. See the daemon's manual page in section 1M for details on
  57. # valid options. If this host is on networks that use subnetting, add the
  58. # appropriate 'netmask' to the ifconfig-*.options files (see ifconfig(1M) for
  59. # details on netmasks).
  60. #
  61. #    File            Status
  62. #    automount.options    optional
  63. #    biod.options        optional
  64. #    gated.options        optional
  65. #    ifconfig-1.options    optional    (for primary network interface)
  66. #    ifconfig-2.options    optional    (for 1st gateway network interface)
  67. #    ifconfig-3.options    optional    (for 2nd gateway network interface)
  68. #    ifconfig-4.options    optional    (for 3rd gateway network interface)
  69. #    ifconfig-hy.options    optional    (for HyperNET interface)
  70. #    inetd.options        optional
  71. #    lockd.options        optional
  72. #    mrouted.options        optional
  73. #    named.options        optional
  74. #    netif.options        optional    (to select different primary &
  75. #                         gateway interfaces, etc.)
  76. #    nfsd.options        optional
  77. #    portmap.options        optional
  78. #    rarpd.options        optional
  79. #    routed.options        optional
  80. #    rpc.passwd.options    optional
  81. #    rtnetd.options        optional
  82. #    rwhod.options        optional
  83. #    snmpd.options        optional
  84. #    timed.options        optional
  85. #    timeslave.options    required
  86. #    ypbind.options        optional
  87. #    ypserv.options        optional
  88. #
  89. # In addition, site-dependent configuration commands to add static routes
  90. # and publish arp entries should be put in a separate shell script called
  91. # /etc/init.d/network.local. Make symbolic links in /etc/rc0.d and
  92. # /etc/rc2.d to this file to have it called during system startup
  93. # and shutdown:
  94. #    ln -s /etc/init.d/network.local /etc/rc0.d/K39network # before network
  95. #    ln -s /etc/init.d/network.local /etc/rc2.d/S31network # after network
  96. # The script is called with one argument ("start" or "stop").
  97. #
  98. #
  99. # Copyright 1988-1991 Silicon Graphics, Inc.
  100. # All rights reserved.
  101. #
  102. # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  103. # the contents of this file may not be disclosed to third parties, copied or
  104. # duplicated in any form, in whole or in part, without the prior written
  105. # permission of Silicon Graphics, Inc.
  106. #
  107. # RESTRICTED RIGHTS LEGEND:
  108. # Use, duplication or disclosure by the Government is subject to restrictions
  109. # as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  110. # and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  111. # successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  112. # rights reserved under the Copyright Laws of the United States.
  113.  
  114.  
  115. CONFIG=/etc/config
  116. IS_ON=/etc/chkconfig
  117.  
  118. # The verbose flag controls the printing of the names of daemons as they
  119. # are started and the printing of NFS-mounted filesystem names as they are
  120. # mounted and unmounted.
  121.  
  122. if $IS_ON verbose ; then
  123.     ECHO=echo
  124.     VERBOSE=-v
  125. else        # For a quiet startup and shutdown
  126.     ECHO=:
  127.     VERBOSE=
  128. fi
  129.  
  130. PATH=$PATH:/usr/etc/yp:.
  131. NFS=/usr/etc
  132. YPDOMFILE=/usr/etc/yp/ypdomain
  133. YPSETDOM=/usr/bin/domainname
  134. IFCONFIG=/usr/etc/ifconfig
  135. ROUTE=/usr/etc/route
  136. localhost=127.1        # definition of 'localhost' in /etc/hosts
  137.  
  138.  
  139. nfs_on () {
  140.     $IS_ON nfs && test -x /etc/havenfs && /etc/havenfs
  141.     return
  142. }
  143.  
  144. configure () {
  145. #  args:  $1 = interface name, $2 = address, $3 = ifconfig options filename
  146. #      $4 = "primary" or ""
  147.     $ECHO "Configuring $1 as $2"
  148.     case "$1" {
  149.     ipg? | imf?)
  150.         if /usr/etc/smtconfig $1 $2 $4 `cat $3 2> /dev/null` 2> /dev/null
  151.         then :
  152.         else
  153.         $IFCONFIG $1 inet $2 $4 `cat $3 2> /dev/null` 2> /dev/null
  154.         fi
  155.         ;;
  156.     *)
  157.         $IFCONFIG $1 inet $2 $4 `cat $3 2> /dev/null` 2> /dev/null
  158.         ;;
  159.     }
  160.     if test $? -ne 0 ; then
  161.     echo "\n*** WARNING: failed to configure $1 as $2\n"
  162.     return 1
  163.     fi
  164.     return 0
  165. }
  166.  
  167.  
  168. if test "`/etc/nvram diskless 2> /dev/null`" -eq 1; then
  169.     DLMNTOPTS='-b /,/share,/swap'
  170.     RFLUSHFLAG=-fq
  171. else
  172.     RFLUSHFLAG=-Fq
  173. fi
  174.  
  175.  
  176. case "$1" in
  177. 'start')
  178.  
  179.     # Check the Internet address to decide how to configure things.
  180.  
  181.     HOSTNAME=`hostname`
  182.     netstate="loopback"
  183.     if test -x /usr/bsd/hostid; then
  184.     if hostid -h $HOSTNAME; then
  185.         if test "`hostid`" = "0xc0000201"; then
  186.         echo "*** $HOSTNAME's Internet address is the default:  \c"
  187.         elif $IS_ON network; then
  188.         netstate="ok"
  189.         fi
  190.     else
  191.         hostid 0
  192.         echo \
  193.         "*** Can't find $HOSTNAME's Internet address in /etc/hosts:\n*** \c"
  194.     fi
  195.     elif $IS_ON network; then
  196.     netstate="ok"    # assume it's ok
  197.     fi
  198.  
  199.  
  200.     # The following tests determine the names and addresses of the primary
  201.     # and gateway interfaces for typical configurtations, where
  202.     #   Name    = interface name reported by "/usr/etc/netstat -i".
  203.     #   Address = hostname in /etc/hosts or an IP address in dot notation.
  204.     #
  205.     # Edit /etc/config/netif.options to override values computed below.
  206.     #
  207.     # Note: If this host has more than 2 interfaces, you must edit
  208.     # /etc/config/netif.options to set if3name & if3addr, and
  209.     # if4name & if4addr, as appropriate.
  210.  
  211.     # Suggested addresses for the primary and gateway interfaces.
  212.     if1addr=$HOSTNAME
  213.     if2addr=gate-$HOSTNAME
  214.  
  215.     if $IFCONFIG ipg0 >/dev/null 2>&1; then        # FDDI
  216.     # If FDDI is present, make it the primary interface and
  217.     # Ethernet the gateway interface.
  218.  
  219.     if1name=ipg0
  220.  
  221.     if $IFCONFIG et0 >/dev/null 2>&1; then        # POWER Series systems
  222.         if2name=et0
  223.     elif $IFCONFIG ec0 >/dev/null 2>&1; then    # Personal Iris series
  224.         if2name=ec0
  225.     elif $IFCONFIG fxp0 >/dev/null 2>&1; then    # Professional IRIS
  226.         if2name=fxp0                # (4D/50-4D/85)
  227.     elif $IFCONFIG enp0 >/dev/null 2>&1; then    # ditto
  228.         if2name=enp0
  229.     fi
  230.     elif $IFCONFIG et0 >/dev/null 2>&1; then
  231.     if1name=et0
  232.     if $IFCONFIG et1 >/dev/null 2>&1; then
  233.         if2name=et1
  234.     elif $IFCONFIG fxp0 >/dev/null 2>&1; then
  235.         if2name=fxp0
  236.     else
  237.         if2name=enp0
  238.     fi
  239.     elif $IFCONFIG ec0 >/dev/null 2>&1; then
  240.     if1name=ec0
  241.     if $IFCONFIG fxp0 >/dev/null 2>&1; then
  242.         if2name=fxp0
  243.     else
  244.         if2name=enp0
  245.     fi
  246.     elif $IFCONFIG fxp0 >/dev/null 2>&1; then
  247.     if1name=fxp0
  248.     if $IFCONFIG fxp1 >/dev/null 2>&1; then
  249.         if2name=fxp1
  250.     else
  251.         if2name=enp0
  252.     fi
  253.     elif $IFCONFIG enp0 >/dev/null 2>&1; then
  254.     if1name=enp0
  255.     if2name=enp1
  256.     fi
  257.  
  258.     # Obtain site-dependent values for if1name,if1addr,...,if4name,if4addr.
  259.     if test -s $CONFIG/netif.options; then
  260.     . $CONFIG/netif.options
  261.     fi
  262.  
  263.  
  264.     # Flush all old routes iff not diskless
  265.     $ROUTE $RFLUSHFLAG >/dev/null 2>&1
  266.  
  267.     # Configure the network interfaces.
  268.     if test "$netstate" = "ok"; then
  269.     if configure $if1name $if1addr $CONFIG/ifconfig-1.options primary;
  270.     then :
  271.     else
  272.         echo "*** WARNING: Can't access primary interface: \c"
  273.         netstate="loopback"
  274.     fi
  275.     elif test "$netstate" != "loopback"; then
  276.     netstate="loopback"
  277.     fi
  278.  
  279.  
  280.     if test $netstate = "loopback"; then
  281.     echo "Using standalone network mode."
  282.  
  283.     if test "$if1name" != ""; then
  284.         $IFCONFIG $if1name inet $if1addr 2>/dev/null
  285.         $IFCONFIG $if1name down          2>/dev/null
  286.     fi
  287.     $IFCONFIG lo0 $localhost
  288.     $ROUTE -q delete net $if1addr $if1addr >/dev/null 2>&1
  289.     $ROUTE -q add 224.0.0.0 $localhost 0   >/dev/null 2>&1
  290.     else
  291.     # IP Packet Filtering daemon.
  292.     #
  293.     # It should be started before any gateway interface is configured "up"
  294.     # in order to guarantee that all inbound packets are filtered.
  295.     if $IS_ON ipfilterd && test -x /usr/etc/ipfilterd; then
  296.         /etc/killall ipfilterd
  297.         /usr/etc/ipfilterd
  298.         $ECHO "Starting ipfilterd."
  299.     fi
  300.  
  301.     # Initialize other boards if this host is a gateway (no harm if
  302.     # they are missing).
  303.  
  304.     if test "$if2name" != "" && $IFCONFIG $if2name >/dev/null 2>&1; then
  305.         configure $if2name $if2addr $CONFIG/ifconfig-2.options
  306.     fi
  307.  
  308.     # Initialize 3rd & 4th boards if names are defined in netif.options.
  309.  
  310.     if test "$if3name" != "" && $IFCONFIG $if3name >/dev/null 2>&1; then
  311.         configure $if3name $if3addr $CONFIG/ifconfig-3.options
  312.     fi
  313.     if test "$if4name" != "" && $IFCONFIG $if4name >/dev/null 2>&1; then
  314.         configure $if4name $if4addr $CONFIG/ifconfig-4.options
  315.     fi
  316.     # If this IRIS has more than 4 network interfaces,
  317.     #  for each interface, copy the "configure" line above,
  318.     #  adjust the interface number and add appropriate ifXname
  319.     #  and ifXaddr variables in the /etc/config/netif.options file.
  320.  
  321.  
  322.     # Initialize the HyperNET interface.
  323.  
  324.     if $IS_ON hypernet && $IFCONFIG hy0 >/dev/null 2>&1  &&
  325.        configure hy0 $HOSTNAME-hy $CONFIG/ifconfig-hy.options ; then
  326.         /usr/etc/hyroute hy0 -s /usr/etc/hyroute.conf
  327.     fi
  328.  
  329.     # Initialize the loop-back interface
  330.     $IFCONFIG lo0 $localhost
  331.     fi
  332.  
  333.     # Send traffic for this host through lo0 for better performance
  334.     HOSTRESORDER=local $ROUTE -q add host $if1addr $localhost 0 >/dev/null 2>&1
  335.  
  336.  
  337.     $ECHO "Network daemons:\c"
  338.  
  339.     if test -x /usr/etc/rtnetd; then
  340.         # Always start on multiprocessors for better throughput
  341.         if $IS_ON rtnetd || test `mpadmin -u | wc -l` -gt 1; then
  342.         /usr/etc/rtnetd `cat $CONFIG/rtnetd.options 2> /dev/null`
  343.                             $ECHO " rtnetd\c"
  344.         fi
  345.     fi
  346.  
  347.     /etc/killall gated routed mrouted portmap named
  348.  
  349.     if test $netstate = "ok" ; then
  350.  
  351.         # Start either gated (the fancy routing daemon) or routed.
  352.         #
  353.         # Note: gated and mrouted use configuration files in /usr/etc.
  354.         # See gated(1M) and mrouted(1M) for details on their setup.
  355.  
  356.         if $IS_ON gated && test -x /usr/etc/gated ; then
  357.  
  358.             /usr/etc/gated `cat $CONFIG/gated.options 2> /dev/null` &
  359.                             $ECHO " gated\c"
  360.         elif $IS_ON routed && test -x /usr/etc/routed ; then
  361.  
  362.         # Useful option:
  363.         #    -q = "quiet": don't act as router if > 1 interface.
  364.         # See routed(1M) for other options.
  365.  
  366.         /usr/etc/routed `cat $CONFIG/routed.options 2> /dev/null` &
  367.                             $ECHO " routed\c"
  368.         fi
  369.  
  370.         # Set the default route for all IP multicast packets to the
  371.         # primary interface.
  372.        HOSTRESORDER=local $ROUTE -q add 224.0.0.0 $if1addr 0 >/dev/null 2>&1
  373.  
  374.         if $IS_ON mrouted && test -x /usr/etc/mrouted; then
  375.         /usr/etc/mrouted `cat $CONFIG/mrouted.options 2> /dev/null` &
  376.                             $ECHO " mrouted\c"
  377.         fi
  378.     fi
  379.  
  380.     if test -x /usr/etc/portmap; then
  381.         /usr/etc/portmap `cat $CONFIG/portmap.options 2> /dev/null` &
  382.                             $ECHO " portmap\c"
  383.     fi
  384.  
  385.     # Berkeley Internet Name Domain server:
  386.     #
  387.     #   It has to be started before NIS and NFS so they can use hostnames
  388.     #   not in /etc/hosts.
  389.     if $IS_ON named && test -x /usr/etc/named; then
  390.         /usr/etc/named `cat $CONFIG/named.options 2> /dev/null` < /dev/null
  391.                             $ECHO " named\c"
  392.     fi
  393.  
  394.  
  395.     $ECHO "."
  396.  
  397.  
  398.     # Define the NIS domain name.
  399.     if test -x $YPSETDOM; then
  400.     # The ypdomain file is needed only if NIS domain != Internet domain.
  401.     YPDOMAIN=`cat $YPDOMFILE 2> /dev/null`
  402.  
  403.     if test ! "$YPDOMAIN" ; then
  404.         # Extract the domain from the hostname.
  405.         YPDOMAIN=`echo $HOSTNAME | sed -e 's/[^.]*\.\(.*\)/\1/'`
  406.         if test "$YPDOMAIN" = "$HOSTNAME"; then
  407.         # Hostname doesn't contain domain.
  408.         YPDOMAIN=""
  409.         fi
  410.     fi
  411.  
  412.     # Set the domain even if "yp" is not "on" so ypbind can be
  413.     # started by hand later.
  414.     if test "$YPDOMAIN"; then
  415.         $YPSETDOM $YPDOMAIN
  416.     fi
  417.     fi
  418.  
  419.     # Fire up NIS daemons.
  420.  
  421.     if test $netstate = "ok" && $IS_ON yp ; then
  422.     if test ! "$YPDOMAIN" ; then
  423.         echo "\n*** WARNING: Can't start NIS -- domain name not defined."
  424.         echo "*** Edit $YPDOMFILE to contain your domain name and reboot.\n"
  425.     else
  426.         YPDBDIR=$NFS/yp/$YPDOMAIN
  427.  
  428.         $YPSETDOM  $YPDOMAIN
  429.         /etc/killall ypbind ypserv rpc.passwd
  430.  
  431.         $ECHO "NIS domain: $YPDOMAIN"
  432.         $ECHO "NIS daemons:\c"
  433.  
  434.         #   NIS type:        Must run:
  435.         #   master server    ypserv, rpc.passwd, ypbind
  436.         #   slave server    ypserv, ypbind
  437.         #   client        ypbind
  438.  
  439.         # Make this host a NIS server.
  440.         if $IS_ON ypserv && test -x $NFS/ypserv; then
  441.             if test -d $YPDBDIR ; then
  442.  
  443.             # Useful option:
  444.             #   -i = get inter-domain host info from named
  445.  
  446.             $NFS/ypserv `cat $CONFIG/ypserv.options 2> /dev/null` &
  447.                             $ECHO " ypserv\c"
  448.             else
  449.             echo "\n*** WARNING: ypserv not started -- $YPDBDIR database dir. missing"
  450.             fi
  451.         fi
  452.  
  453.  
  454.         # Make this host the NIS master server for the passwd file.
  455.         if $IS_ON ypmaster && test -x $NFS/rpc.passwd; then
  456.  
  457.             # A reasonable alternate password file is '/etc/passwd.yp'
  458.             #    This allows the valid accounts on the NIS master
  459.             #    to not be all valid accounts in the network.
  460.             PASSWD=`cat $CONFIG/rpc.passwd.options 2> /dev/null`
  461.  
  462.             $NFS/rpc.passwd ${PASSWD:=/etc/passwd} -m passwd &
  463.                             $ECHO " rpc.passwd\c"
  464.         fi
  465.  
  466.         # ypbind allows NIS servers and clients to use NIS services.
  467.         if test -x $NFS/ypbind; then
  468.             $NFS/ypbind `cat $CONFIG/ypbind.options 2> /dev/null` &
  469.                             $ECHO " ypbind\c"
  470.             sleep 2
  471.         fi
  472.  
  473.         $ECHO "."
  474.     fi
  475.     fi
  476.  
  477.  
  478.     # Fire up NFS daemons if the kernel supports NFS and the daemons are
  479.     # present and executable.  Also mount the NFS filesystems in /etc/fstab.
  480.  
  481.     if test "$netstate" = "ok" && nfs_on ; then
  482.  
  483.     # Clear this host from the client list (/etc/rmtab) of all
  484.     # servers on the network.  Remove any stale exports from
  485.     # the current exports list (/etc/xtab).
  486.  
  487.     2>&1 umount -at nfs ${DLMNTOPTS} > /dev/null
  488.     2>&1 $NFS/exportfs -au > /dev/null
  489.  
  490.     $ECHO "NFS daemons:\c"
  491.  
  492.         /etc/killall nfsd biod
  493.  
  494.         # NFS server daemons
  495.         if test -x $NFS/nfsd; then
  496.         NNFSD=`cat $CONFIG/nfsd.options 2> /dev/null`
  497.         $NFS/nfsd ${NNFSD:=4};            $ECHO " nfsd\c"
  498.         fi
  499.  
  500.         # NFS client bio daemons
  501.         if test -x $NFS/biod; then
  502.         NBIOD=`cat $CONFIG/biod.options 2> /dev/null`
  503.         $NFS/biod ${NBIOD:=4};            $ECHO " biod\c"
  504.         fi
  505.  
  506.     $ECHO "."
  507.  
  508.     /etc/mount $VERBOSE -at nfs ${DLMNTOPTS}
  509.     $NFS/exportfs -a $VERBOSE
  510.  
  511.  
  512.     if $IS_ON automount || $IS_ON lockd || $IS_ON pcnfsd ; then
  513.         $ECHO "Other NFS daemons:\c"
  514.  
  515.         # Start the NFS automounter daemon
  516.         if $IS_ON automount && test -x $NFS/automount ; then
  517.         if /etc/killall -TERM automount ; then
  518.             sleep 2    # Allow it some time to clean up.
  519.         fi
  520.         $NFS/automount \
  521.             `cat $CONFIG/automount.options 2> /dev/null` >/dev/null 2>&1
  522.                             $ECHO " automount\c"
  523.         fi
  524.  
  525.         # Start the NFS lock and status daemons
  526.         if $IS_ON lockd ; then
  527.         if test -x $NFS/rpc.statd ; then
  528.             /etc/killall rpc.statd
  529.             $NFS/rpc.statd;            $ECHO " statd\c"
  530.         fi
  531.         if test -x $NFS/rpc.lockd ; then
  532.             /etc/killall rpc.lockd
  533.             $NFS/rpc.lockd `cat $CONFIG/lockd.options 2> /dev/null` &
  534.                             $ECHO " lockd\c"
  535.         fi
  536.         fi
  537.  
  538.         # PC-NFS server daemon
  539.         if $IS_ON pcnfsd && test -x $NFS/pcnfsd ; then
  540.         $NFS/pcnfsd;                $ECHO " pcnfsd\c"
  541.         fi
  542.  
  543.         $ECHO "."
  544.     fi
  545.     fi
  546.  
  547.  
  548.     # Daemons started below may reside on NFS filesystems.
  549.  
  550.     $ECHO "Internet daemons:\c"
  551.  
  552.     /etc/killall inetd timed timeslave rarpd rwhod snmpd
  553.  
  554.     # Internet super-server:
  555.     #
  556.     #  Invokes servers in /usr/etc/inetd.conf. Use the inetd.options file
  557.     #  to specify a different configuration file.
  558.  
  559.     if test -x /usr/etc/inetd; then
  560.         /usr/etc/inetd `cat $CONFIG/inetd.options 2> /dev/null` < /dev/null
  561.                         $ECHO " inetd\c"
  562.     fi
  563.  
  564.  
  565.     # Time synchronization servers:
  566.     #  timed keeps time consistent among machines on a local network.
  567.     #  timeslave tracks changes made by a master time keeper.
  568.     #
  569.     #  Timed can be given options in $CONFIG/timed.options, detailed
  570.     #  in the timed(1M) man page.
  571.     #
  572.     #  Timeslave requires the name of host to follow (-H hostname)
  573.     #  or the name of clock device that listens to WWV (-C /dev/ttyXX).
  574.     #  Other options are listed in the man page.
  575.  
  576.     if $IS_ON timed && test $netstate = "ok" -a -x /usr/etc/timed ; then
  577.         /usr/etc/timed -M `cat $CONFIG/timed.options 2> /dev/null` &
  578.                         $ECHO " timed\c"
  579.     fi
  580.     if $IS_ON timeslave && test -x /usr/etc/timeslave ; then
  581.         if test -s $CONFIG/timeslave.options ; then
  582.         /usr/etc/timeslave `cat $CONFIG/timeslave.options` &
  583.                         $ECHO " timeslave\c"
  584.         else
  585.         echo "\n*** WARNING: timeslave not started -- options missing"
  586.             echo "***   Add them to $CONFIG/timeslave.options and reboot\n"
  587.         fi
  588.     fi
  589.  
  590.  
  591.     # RARPD: Reverse ARP daemon.
  592.     #
  593.     #  RARP is used by Sun diskless clients to discover their Internet
  594.     #  addresses, given their Ethernet addresses.
  595.  
  596.     if $IS_ON rarpd && test $netstate = "ok" -a -x /usr/etc/rarpd ; then
  597.         /usr/etc/rarpd `cat $CONFIG/rarpd.options 2> /dev/null` &
  598.                         $ECHO " rarpd\c"
  599.     fi
  600.  
  601.  
  602.     # Rwhod: 4.3BSD's system status daemon.
  603.     #
  604.     #  Important: if there are lots of hosts on the network,
  605.     #  DO NOT run rwhod because it can saturate the network.
  606.  
  607.     if $IS_ON rwhod && test $netstate = "ok" -a -x /usr/etc/rwhod; then
  608.         if test ! -d /usr/spool/rwho; then
  609.         mkdir /usr/spool/rwho
  610.         fi
  611.         /usr/etc/rwhod `cat $CONFIG/rwhod.options 2> /dev/null`
  612.                         $ECHO " rwhod\c"
  613.     fi
  614.  
  615.  
  616.     # snmpd: Simple Network Management Protocol daemon.
  617.     #
  618.     # SNMP (RFC 1157) is used to query MIB variables (RFC 1158)
  619.     # from a network entity.
  620.  
  621.     if $IS_ON snmpd && test $netstate = "ok" -a -x /usr/etc/snmpd; then
  622.         /usr/etc/snmpd `cat $CONFIG/snmpd.options 2> /dev/null`
  623.                         $ECHO " snmpd\c"
  624.     fi
  625.  
  626.     $ECHO "."
  627.  
  628.     if $IS_ON 4DDN && test $netstate = "ok" -a -x /usr/etc/dn/dnstart.sh; then
  629.     /etc/killall -TERM dnserver
  630.     /usr/etc/dn/dnstart.sh $VERBOSE
  631.     fi
  632.  
  633.     ;;
  634.  
  635.  
  636. 'stop')
  637.  
  638.     #  Servers that might start shells.
  639.     USERS='rlogind rexecd rshd ftpd telnetd sethostd dnserver'
  640.     #  The following servers should be killed immediately.
  641.     EDAEMONS='inetd bootp tftpd timed timeslave rarpd rwhod talkd fingerd
  642.         automount rpc.mountd rpc.lockd rpc.statd rpc.bootparamd
  643.         rpc.rexd rpc.rstatd rpc.rusersd rpc.rwalld rpc.ypupdated
  644.         fal smtd snmpd'
  645.     #  Remote daemons
  646.     RDAEMONS='ypserv ypbind rpc.passwd nfsd biod pcnfsd rpc.rquotad
  647.         named gated routed mrouted'
  648.     #  These daemons should be kept alive until the last minute.
  649.     LDAEMONS='portmap slip ipfilterd'
  650.  
  651.     #  Kill (probable) shell process groups first
  652.     /etc/killall -g 1 $USERS
  653.     sleep 1
  654.     /etc/killall -TERM $EDAEMONS $USERS
  655.  
  656.     sleep 1
  657.     /etc/umount $VERBOSE -kt nfs ${DLMNTOPTS}
  658.     /etc/killall -TERM $RDAEMONS
  659.     sleep 1
  660.  
  661.     #  Unexport any exported NFS filesystems (assumes netstate = ok)
  662.     #    Do this after killing the NFS demons so that clients do not
  663.     #    suffer errors on their read(2) requests, if they have hard-mounted
  664.     #    things.  /usr may not be mounted, so you must check to see
  665.     #    that exportfs is available.
  666.     if nfs_on && test -x $NFS/exportfs; then
  667.     $NFS/exportfs -au $VERBOSE
  668.     fi
  669.  
  670.     #  Blow away any background mounts and the broadcast umount since
  671.     #    the network will be shut down soon.
  672.     /etc/killall mount umount $USERS $EDAEMONS $RDAEMONS $LDAEMONS rtnetd
  673.  
  674.     #  Shutdown FDDI to turn off the optical bypasses and cleanly take
  675.     #  the system out of the ring.
  676.     for num in 0 1 2 3 ; do
  677.     $IFCONFIG ipg$num down 2> /dev/null
  678.     done
  679.  
  680.     ;;
  681.  
  682.  
  683. *)
  684.     echo "usage: $0 {start|stop}"
  685.     ;;
  686. esac
  687.  
  688. # DECnet is a trademark of Digital Equipment Corp.
  689. # NFS is a trademark of Sun Microsystems, Inc.
  690.